package org.hot100_3;

import java.util.ArrayList;
import java.util.List;

public class leetcode78 {

    List<Integer> item = new ArrayList<>();
    List<List<Integer>> res = new ArrayList<>();
    public List<List<Integer>> subsets(int[] nums) {

        backtracking(nums,0);

        return res;
    }


    private void backtracking(int [] nums,int index){

        res.add(new ArrayList<>(item));

        for (int i = index; i < nums.length ; i++) {
            item.add(nums[i]);
            backtracking(nums,i+1);
            item.remove(item.size()-1);
        }
    }
}
